using System.Text;

public static class EncryptorDecryptor
{
    public static string EncryptDecrypt(string textToEncrypt, int key = 185)
    {
        StringBuilder inSb = new StringBuilder(textToEncrypt);
        StringBuilder outSb = new StringBuilder(textToEncrypt.Length);
        char c;
        for (int i = 0; i < textToEncrypt.Length; i++)
        {
            c = inSb[i];
            c = (char)(c ^ key);
            outSb.Append(c);
        }
        return outSb.ToString();
    }

    public static byte[] EncryptDecryptBytes(byte[] dataToEncrypt, int key = 185)
    {
        byte[] outBytes = new byte[dataToEncrypt.Length];
        byte c;
        for (int i = 0; i < dataToEncrypt.Length; i++)
        {
            c = dataToEncrypt[i];
            c = (byte)(c ^ key);
            outBytes[i] = c;
        }
        return outBytes;
    }
}
